﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TYBase
{
    public static class TimeExtends
    {
        public static long AsTick(this DateTime dt)
        {
            return (dt.Ticks - 621355968000000000) / 10000000;
        }
        static DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);

        public static DateTime AsTime(this long? value)
        {
            if (value == null)
                return DateTime.MinValue;
            return dt.AddMilliseconds(value.Value);
        }
    }
}
